home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / bwmixr10 / sample1.frm < prev    next >
Text File  |  1999-03-15  |  15KB  |  394 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  3. Object = "{8ED25283-DB3A-11D2-AC41-00C0DFE9A30F}#22.0#0"; "BWmixer1b.ocx"
  4. Begin VB.Form Form1 
  5.    Caption         =   "BinaryWork Mixer OCX - Sample Project"
  6.    ClientHeight    =   5400
  7.    ClientLeft      =   165
  8.    ClientTop       =   735
  9.    ClientWidth     =   7065
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5400
  12.    ScaleWidth      =   7065
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.ListBox List1 
  15.       Height          =   645
  16.       Left            =   3600
  17.       TabIndex        =   9
  18.       Top             =   4680
  19.       Width           =   3375
  20.    End
  21.    Begin BwMixerOCX.BWMixer BWMixer1 
  22.       Left            =   6120
  23.       Top             =   3840
  24.       _ExtentX        =   979
  25.       _ExtentY        =   979
  26.    End
  27.    Begin VB.CheckBox Check1 
  28.       Enabled         =   0   'False
  29.       Height          =   255
  30.       Left            =   120
  31.       TabIndex        =   0
  32.       Top             =   3600
  33.       Width           =   4215
  34.    End
  35.    Begin VB.Timer Timer1 
  36.       Enabled         =   0   'False
  37.       Interval        =   1000
  38.       Left            =   3240
  39.       Top             =   1560
  40.    End
  41.    Begin ComctlLib.Slider Slider1 
  42.       Height          =   255
  43.       Left            =   0
  44.       TabIndex        =   2
  45.       Top             =   3960
  46.       Width           =   1335
  47.       _ExtentX        =   2355
  48.       _ExtentY        =   450
  49.       _Version        =   327682
  50.    End
  51.    Begin ComctlLib.ListView ListView1 
  52.       Height          =   3255
  53.       Left            =   50
  54.       TabIndex        =   1
  55.       Top             =   240
  56.       Width           =   6975
  57.       _ExtentX        =   12303
  58.       _ExtentY        =   5741
  59.       LabelEdit       =   1
  60.       LabelWrap       =   -1  'True
  61.       HideSelection   =   -1  'True
  62.       _Version        =   327682
  63.       ForeColor       =   -2147483640
  64.       BackColor       =   -2147483643
  65.       BorderStyle     =   1
  66.       Appearance      =   1
  67.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  68.          Name            =   "Small Fonts"
  69.          Size            =   6.75
  70.          Charset         =   0
  71.          Weight          =   400
  72.          Underline       =   0   'False
  73.          Italic          =   0   'False
  74.          Strikethrough   =   0   'False
  75.       EndProperty
  76.       NumItems        =   0
  77.    End
  78.    Begin VB.Label Label3 
  79.       Caption         =   "Mixers available in the system"
  80.       Height          =   255
  81.       Left            =   3600
  82.       TabIndex        =   10
  83.       Top             =   4440
  84.       Width           =   3015
  85.    End
  86.    Begin VB.Label Label11 
  87.       Height          =   255
  88.       Left            =   120
  89.       TabIndex        =   8
  90.       Top             =   5040
  91.       Width           =   5055
  92.    End
  93.    Begin VB.Label Label9 
  94.       Height          =   255
  95.       Left            =   120
  96.       TabIndex        =   7
  97.       Top             =   4800
  98.       Width           =   5055
  99.    End
  100.    Begin VB.Label Label7 
  101.       Height          =   255
  102.       Left            =   120
  103.       TabIndex        =   6
  104.       Top             =   4560
  105.       Width           =   5055
  106.    End
  107.    Begin VB.Label Label5 
  108.       Height          =   255
  109.       Left            =   120
  110.       TabIndex        =   5
  111.       Top             =   4320
  112.       Width           =   4815
  113.    End
  114.    Begin VB.Label Label2 
  115.       Height          =   255
  116.       Left            =   1560
  117.       TabIndex        =   4
  118.       Top             =   3960
  119.       Width           =   4215
  120.    End
  121.    Begin VB.Label Label1 
  122.       Caption         =   "Click in the list to select the device to be controled"
  123.       Height          =   255
  124.       Left            =   120
  125.       TabIndex        =   3
  126.       Top             =   0
  127.       Width           =   4815
  128.    End
  129.    Begin VB.Menu About 
  130.       Caption         =   "About"
  131.    End
  132. End
  133. Attribute VB_Name = "Form1"
  134. Attribute VB_GlobalNameSpace = False
  135. Attribute VB_Creatable = False
  136. Attribute VB_PredeclaredId = True
  137. Attribute VB_Exposed = False
  138.  
  139. 'Definition of the variables that are required to the mixer
  140.  
  141. Dim DeviceSelectionName As String  'the name of the device returned by the mixer
  142. Dim DeviceSelection As Long  'The DeviceID that is required to get and set the value
  143. Dim DeviceTypeSelected As Long 'The DeviceType that is required also in order to get and set the
  144. Dim DeviceMaximumValue As Long 'The maximum value of the actual device selected , this is required also
  145.  
  146. Dim NewValue As Long
  147.  
  148. Private Sub About_Click()
  149. BWMixer1.About
  150. End Sub
  151.  
  152. 'Fl;ags to avoid the refresh of the form if the value have not changed since the last update
  153.  
  154. 'This event return any error generated in the mixer , with description also
  155. Private Sub BWMixer1_MixerError(ErrorCode As Long, errorDescription As String)
  156. Form1.Caption = errorDescription
  157. End Sub
  158.  
  159. 'This event will return the mixer properites , this was called by InitialiZe mixer or GetMixerProperties
  160. Private Sub BWMixer1_ReturnMixerProperties(MixerName As String, ManufacturerId As Integer, ProductId As Integer, DriverVersion As Long)
  161.  
  162. Label11.Caption = "Driver version : " & DriverVersion
  163. Label9.Caption = "Product ID : " & ProductId
  164. Label7.Caption = "Manufacturer ID : " & ManufacturerId
  165. Label5.Caption = "Mixer description : " & MixerName
  166.  
  167. End Sub
  168.  
  169. '"This event will list any device detected by the Mixer , and here you can see
  170. 'the extended capabilities of our mixer , this will list any information that is required in order to access
  171. 'and change any device available
  172. 'This was called by InitializeMixer
  173.  
  174. Private Sub BWMixer1_ReturnDevicesAvailable(DeviceName As String, ShortDeviceName As String, KnownDevice As String, DeviceId As Long, DeviceType As Long, MaximumValue As Long)
  175.  
  176. Set minhalista = ListView1.ListItems.Add(1, , DeviceName)
  177. ListView1.ListItems.Item(1).SubItems(1) = DeviceId
  178. ListView1.ListItems.Item(1).SubItems(2) = DeviceType
  179. ListView1.ListItems.Item(1).SubItems(3) = KnownDevice
  180. ListView1.ListItems.Item(1).SubItems(4) = MaximumValue
  181. End Sub
  182.  
  183. Private Sub BWMixer1_ReturnMixersInTheSystem(MixerName As String, ManufacturerId As Integer, ProductId As Integer, DriverVersion As Long)
  184. 'it will fill the listbox with the name of the mixers in the system
  185. List1.AddItem MixerName
  186.  
  187. End Sub
  188.  
  189. Private Sub Check1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  190.  
  191. Dim ret As Long
  192. ret = BWMixer1.SetValueByType(DeviceSelection, DeviceTypeSelected, Check1.Value)
  193.  
  194. End Sub
  195.  
  196.  
  197.  
  198. Private Sub Form_Activate()
  199.  
  200. 'This will create the definition of the listview1
  201.  
  202. Dim clmX As ColumnHeader
  203.     Set clmX = ListView1.ColumnHeaders. _
  204.     Add(, , "Device Name", ListView1.Width / 4)
  205. Set clmX = ListView1.ColumnHeaders. _
  206.     Add(, , "Device ID", ListView1.Width / 12)
  207.     Set clmX = ListView1.ColumnHeaders. _
  208.     Add(, , "Device Type", ListView1.Width / 8)
  209.     Set clmX = ListView1.ColumnHeaders. _
  210.     Add(, , "Known Device", ListView1.Width / 6)
  211.     Set clmX = ListView1.ColumnHeaders. _
  212.     Add(, , "Max Value", ListView1.Width / 8)
  213.  
  214. ListView1.View = lvwReport
  215.  
  216. 'This will Intialize the mixer in the first activation of the form . without it the mixer will not work or update
  217.  
  218. If BWMixer1.IsInitialized = False Then
  219. BWMixer1.InitializeMixer
  220. End If
  221.  
  222. 'this will raise the events with the information about the mixers available and their descriptions
  223.  
  224. BWMixer1.GetMixersAvailable
  225. BWMixer1.GetMixerProperties
  226.  
  227. End Sub
  228.  
  229. Private Sub ListView1_Click()
  230.  
  231. If BWMixer1.IsInitialized = False Then Exit Sub 'This will verify if the mixer is initialized
  232.  
  233. DeviceSelectionName = ListView1.SelectedItem
  234. DeviceSelection = ListView1.SelectedItem.SubItems(1)
  235. DeviceTypeSelected = ListView1.SelectedItem.SubItems(2)
  236. DeviceMaximumValue = ListView1.SelectedItem.SubItems(4)
  237.  
  238. If DeviceMaximumValue > 1 Then  'it will verify if the value need to be expressed in a checkbox or a slider
  239.         
  240.         'the folowing flags will avoid the update of the objects if the value is the same of the last update o